﻿@model SectionGroup
@{
    string tabId = Guid.NewGuid().ToString("N");
}
<div class="section-group-tab">
    <ul class="nav nav-tabs" role="tablist">
        @{
            var titles = Model.SectionContents.Where(m => m.SectionContentType == (int)SectionContentBase.Types.Title).Cast<SectionContentTitle>().ToList();
            for (int i = 0; i < titles.Count; i++)
            {
                var itemId = tabId + "-" + i;
                <li role="presentation" class="@(i==0?"active":"")">
                    <a href="#@itemId" aria-controls="@itemId" role="tab" data-toggle="tab">@titles[i].InnerText</a>
                </li>
            }
        }
    </ul>
    <div class="tab-content">
        @{
            var paragraphs = Model.SectionContents.Where(m => m.SectionContentType == (int)SectionContentBase.Types.Paragraph).Cast<SectionContentParagraph>().ToList();
            for (int i = 0; i < paragraphs.Count; i++)
            {
                var itemId = tabId + "-" + i;
                <div role="tabpanel" class="tab-pane @(i==0?"active":"")" id="@itemId">
                    @Html.Raw(paragraphs[i].HtmlContent)
                </div>
            }
        }

    </div>
</div>
